#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

bool cmp(std::pair<char, int> a, std::pair<char, int> b)
{
    if (a.second != b.second)
    {
        return a.second > b.second;
    }
    return a.first < b.first;
}

int main()
{
    std::string str;
    std::getline(std::cin, str);

    std::vector<std::pair<char, int>> continue_vec;
    std::vector<std::pair<char, int>> discontinue_vec;
    std::unordered_map<char, int> cnt_map;

    std::string filter_str;
    int lower_num = 'Z' - 'z';
    for (int i = 0; i < str.size(); i++)
    {
        if (str[i] <= 'z' && str[i] >= 'a')
        {
            filter_str.push_back(str[i]);
        }
        else if ((str[i] <= 'Z' && str[i] >= 'A'))
        {
            filter_str.push_back(str[i] - lower_num);
        }
    }

    int i = 0;
    while (i < filter_str.size())
    {
        char current_char = filter_str[i];
        int count = 1;
        i++;
        while (i < filter_str.size() && filter_str[i] == current_char)
        {
            count++;
            i++;
        }

        cnt_map[current_char] += count;
        if (count > 1)
        {
            continue_vec.push_back({current_char, count});
        }
        else
        {
            discontinue_vec.push_back({current_char, cnt_map[current_char]});
        }
    }

    std::vector<std::pair<char, int>> result;
    for (int i = 0; i < continue_vec.size(); i++)
    {
        result.push_back(continue_vec[i]);
    }
    for (int i = 0; i < discontinue_vec.size(); i++)
    {
        result.push_back({discontinue_vec[i].first, cnt_map[discontinue_vec[i].first] - discontinue_vec[i].second});
    }

    std::sort(result.begin(), result.end(), cmp);
    std::string output;
    for (int i = 0; i < result.size(); i++)
    {
        output += result[i].first;
        output += std::to_string(result[i].second);
    }
    std::cout << output << std::endl;
    return 0;
}